package com.example.mobile2021606127cxz0615homework;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

import androidx.annotation.Nullable;

public class MySQLiteOpenHelper extends SQLiteOpenHelper {
    public MySQLiteOpenHelper(@Nullable Context context, @Nullable String name, @Nullable SQLiteDatabase.CursorFactory factory, int version) {
        super(context, name, factory, version);
    }

    @Override
    public void onCreate(SQLiteDatabase db) {
        String sql1="create table CarPeccancy(_id integer primary key autoincrement,carnumber varchar(20) ,pcode varchar(20), pdatetime varchar(20),paddr varchar(20))";
        db.execSQL(sql1);

        String sql2="create table Sense(_id integer primary key autoincrement,Co2 integer ,Pm25 integer, LightIntensity integer,humidity integer,temperature integer)";
        db.execSQL(sql2);

        String sql3="create table CarInfor(_id integer primary key autoincrement,carnumber varchar(20) ,number varchar(20), pcardid varchar(20),buydata varchar(20),carbrand varchar(20))";
        db.execSQL(sql3);

    }

    @Override
    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {

    }
}
